package com.ssy.lingxi.member.merchant.repository;

import com.ssy.lingxi.member.merchant.entity.BaseLevelConfigDO;
import com.ssy.lingxi.member.merchant.entity.RoleDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 会员等级配置Repository
 * @author 万宁
 * @version 2.0.0
 * @date 2020-08-23
 */
@Repository
public interface BaseLevelConfigRepository extends JpaRepository<BaseLevelConfigDO, Long>, JpaSpecificationExecutor<BaseLevelConfigDO> {

    List<BaseLevelConfigDO> findByMemberLevelTypeEnumAndLevel(Integer memberLevelTypeEnum, Integer level);

    BaseLevelConfigDO findFirstByRoleAndMemberLevelTypeEnumAndLevel(RoleDO role, Integer memberLevelTypeEnum, Integer level);

    List<BaseLevelConfigDO> findByMemberLevelTypeEnumNotAndStatus(Integer memberLevelTypeEnum, Integer status);

    List<BaseLevelConfigDO> findByMemberLevelTypeEnumAndStatus(Integer memberLevelTypeEnum, Integer status);

    List<BaseLevelConfigDO> findByMemberLevelTypeEnumAndStatusAndRole(Integer memberLevelTypeEnum, Integer status, RoleDO roleDO);
}
